/**
 * 
 */
package edu.towson.cosc603.coffeemaker;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * @author Jesus lamb
 *
 */
public class RecipeTest extends TestCase {
	private CoffeeMaker cm;
	private Recipe r1;

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		cm = new CoffeeMaker();
		r1 = new Recipe();
		r1.setName("Coffee");
		r1.setPrice(50);
		r1.setAmtCoffee(3);
		r1.setAmtMilk(1);
		r1.setAmtSugar(1);
		r1.setAmtChocolate(0);
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
		cm = null;
		r1 = null;
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#getAmtChocolate()}.
	 */
	@Test
	public void testGetAmtChocolate() {
		cm.addRecipe(r1);
		assertEquals(0, r1.getAmtChocolate());
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#setAmtChocolate(int)}.
	 */
	@Test
	public void testSetAmtChocolate() {
		r1.setAmtChocolate(2);
		assertEquals(2,r1.getAmtChocolate());
	}
	@Test
	public void testSetAmtChocolateZero() {
		r1.setAmtChocolate(0);
		assertEquals(0,r1.getAmtChocolate());
	}
	@Test
	public void testSetAmtChocolateNegative() {
		r1.setAmtChocolate(-2);
		assertEquals(0,r1.getAmtChocolate());
	}
	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#getAmtCoffee()}.
	 */
	@Test
	public void testGetAmtCoffee() {
		cm.addRecipe(r1);
		assertEquals(3,r1.getAmtCoffee());
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#setAmtCoffee(int)}.
	 */
	@Test
	public void testSetAmtCoffee() {
		r1.setAmtCoffee(4);
		assertEquals(4,r1.getAmtCoffee());
	}
	@Test
	public void testSetAmtCoffeeZero() {
		r1.setAmtCoffee(0);
		assertEquals(0,r1.getAmtCoffee());
	}
	@Test
	public void testSetAmtCoffeeNegative() {
		r1.setAmtCoffee(-2);
		assertEquals(0,r1.getAmtCoffee());
	}
	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#getAmtMilk()}.
	 */
	@Test
	public void testGetAmtMilk() {
		cm.addRecipe(r1);
		assertEquals(1,r1.getAmtMilk());
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#setAmtMilk(int)}.
	 */
	@Test
	public void testSetAmtMilk() {
		r1.setAmtMilk(5);
		assertEquals(5,r1.getAmtMilk());
	}
	@Test
	public void testSetAmtMilkZero() {
		r1.setAmtMilk(0);
		assertEquals(0,r1.getAmtMilk());
	}
	@Test
	public void testSetAmtMilkNegative() {
		r1.setAmtMilk(-1);
		assertEquals(0,r1.getAmtMilk());
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#getAmtSugar()}.
	 */
	@Test
	public void testGetAmtSugar() {
		cm.addRecipe(r1);
		assertEquals(1,r1.getAmtSugar());
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#setAmtSugar(int)}.
	 */
	@Test
	public void testSetAmtSugar() {
		r1.setAmtSugar(2);
		assertEquals(2, r1.getAmtSugar());
	}
	@Test
	public void testSetAmtSugarZero() {
		r1.setAmtSugar(0);
		assertEquals(0,r1.getAmtSugar());
	}
	@Test
	public void testSetAmtSugarNegative() {
		r1.setAmtSugar(-2);
		assertEquals(0,r1.getAmtSugar());
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#getName()}.
	 */
	@Test
	public void testGetName() {
		cm.addRecipe(r1);
		assertEquals("Coffee", r1.getName());
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#setName(java.lang.String)}.
	 */
	@Test
	public void testSetName() {
		r1.setName("Mocha");
		assertEquals("Mocha",r1.getName());
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#getPrice()}.
	 */
	@Test
	public void testGetPrice() {
		cm.addRecipe(r1);
		assertEquals(50,r1.getPrice());
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#setPrice(int)}.
	 */
	@Test
	public void testSetPrice() {
		r1.setPrice(60);
		assertEquals(60,r1.getPrice());
	}
	@Test
	public void testSetPriceNegative() {
		r1.setPrice(-60);
		assertEquals(0,r1.getPrice());
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#equals(edu.towson.cosc603.coffeemaker.Recipe)}.
	 */
	@Test
	public void testEqualsRecipe() {
		Recipe r2 = new Recipe();
		r2.setName("Coffee");
		r2.setPrice(60);
		r2.setAmtCoffee(3);
		r2.setAmtMilk(2);
		r2.setAmtSugar(0);
		r2.setAmtChocolate(1);
		assertTrue(r1.equals(r2));
	}

	/**
	 * Test method for {@link edu.towson.cosc603.coffeemaker.Recipe#toString()}.
	 */
//	@Test
//	public void testToString() {
//		fail("Not yet implemented");
//	}

}
